package service

import "fmt"

type User struct {
	Name string
	Age  int
}

type OptionQuery interface {
	Apply(users []*User) []*User
}

func Where(users []*User) []*User {
	rect := make([]*User, 0, len(users))
	for _, user := range users {
		if user.Name == "11k" {
			rect = append(rect, user)
		}
	}
	return rect
}

// option,可变参数的使用
func Limit(users []*User, options ...User) {
	for id, val := range options {
		fmt.Println(id)
		fmt.Println(val)
	}
}
